WPF and Silverlight Edition Basic Library > RangeSlider > RangeSlider Quick Start > Step 2 of 4: Adding a C1RangeSlider Control |
In the previous step you created a new WPF or Silverlight project and added a Rectangle control with a gradient to the application. In this step you'll continue by adding a C1RangeSlider control that will control the gradient fill in the Rectangle.
Complete the following steps:
XAML Copy Code<c1:C1RangeSlider x:Name="c1rs1">
By giving it a unique identifier, you'll be able to access the control in code.
XAML Copy Code <c1:C1RangeSlider x:Name="c1rs1" Margin="50">This will set each edge the same distance away from the grid's border.
Example Title Copy Code <c1:C1RangeSlider x:Name="c1rs1" Margin="50" Orientation="Vertical">By default Orientation is Horizontal and the control appears across the page.
XAML Copy Code <c1:C1RangeSlider x:Name="c1rs1" Margin="50" Orientation="Vertical" UpperValue="1">The upper thumb will now begin at 1.
XAML Copy Code <c1:C1RangeSlider x:Name="c1rs1" Margin="50" Orientation="Vertical" UpperValue="1" Maximum="1">Users will now not be able to select a value greater than 1.
XAML Copy Code <c1:C1RangeSlider x:Name="c1rs1" Margin="50" Orientation="Vertical" UpperValue="1" Maximum="1" ValueChange="0.1">When you click on the slider track at run time, the slider thumb will now move by 0.1 units.
Example Title Copy Code <c1:C1RangeSlider x:Name="c1rs1" Margin="50" Orientation="Vertical" UpperValue="1" Maximum="1" ValueChange="0.1" Opacity="0.8">By default this property is set to 1 and the control appears completely opaque. Changing this to a lower number will make the control appear slightly transparent.
XAML Copy Code <c1:C1RangeSlider x:Name="c1rs1" Margin="50" Orientation="Vertical" UpperValue="1" Maximum="1" ValueChange="0.1" Opacity="0.8" LowerValueChanged="c1rs1_LowerValueChanged" UpperValueChanged="c1rs1_UpperValueChanged">You'll add code for these event handlers in a later step.
You've successfully set up your application's user interface, but right now the slider will do nothing if you move it. In the next step you'll add code to your application to add functionality.